<?php
include './main.php';
$strName = $_GET["userName"];
$strPassword = $_GET["password"];
//$strName = "8848";
//$strPassword = "11";
$sql = "SELECT * FROM admin WHERE username='{$strName}'";
$result = mysqli_query($link, $sql);
if (!$result->num_rows) {
    $code["msg"] = "没有找到该用户！";
    $res = json_encode($code);
    echo $res;
} else {
    $row = $result->fetch_array();
    if($strPassword == $row['password']){
        $code["status"] = true;
        $code["msg"] = "登陆成功";
        $res = json_encode($code);
        echo $res;
    }else{
        $code["msg"] = "密码错误！";
        $res = json_encode($code);
        echo $res;
    }
}
mysqli_close($link);
?>
